package org.footballmanager.pandafootball.system.form.impl;

import lombok.Getter;
import lombok.Setter;
import org.footballmanager.pandafootball.system.domain.FootSociatyInfo;
import org.footballmanager.pandafootball.system.domain.enums.ZDZW;
import org.footballmanager.pandafootball.system.form.SearchForm;
import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example;

import java.io.Serializable;

@Setter
@Getter
public class FootSociatyInfoSearchForm extends SearchForm implements Serializable {
    private static final long serialVersionUID = 8090668615941861240L;
    protected ZDZW relation;
    protected Long zdId;
    protected String zdmc;
    protected Long userId;
    protected Boolean agree;

    public Example buildSearchCommond() {
        Example example = new Example(FootSociatyInfo.class);
        Example.Criteria criteria = example.createCriteria();
        if(relation != null){
            criteria.andEqualTo("relation", relation);
        }
        if(zdId != null){
            criteria.andEqualTo("zdId", zdId);
        }
        if(userId != null){
            criteria.andEqualTo("userId", userId);
        }
        criteria.andEqualTo("delFlag", 0);
        example.orderBy("honor desc");
        return example;
    }

}
